package com.itheima.oneway;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

public class Producer {
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("group3");
        producer.setNamesrvAddr("192.168.23.130:9876");
        producer.start();
        for (int i = 0; i < 10; i++) {
            Message message = new Message("Topic3", "TagA", ("单向牛逼" + i).getBytes(StandardCharsets.UTF_8));
            producer.sendOneway(message);

        }
        producer.shutdown();
    }
}
